Refactoring and improvments in modules