Put a biodegradable paper bag in the trash and you have no more trouble with maggots.
For me it really helps.
However, make sure the container is dry
Unpleasant odors in the garbage can be reduced by filling pantyhose with cats grid and to do this at the bottom of your bin. This also works for the fridge!