Code cleanup, refactor, implement common interfaces, mixins and config