Major refactor. Now is a module