started to fix margins and some refactoring