A bit of cleaning
Refactor optimizer to make use of the module pattern