A lot of refactoring, separated different modules, changed coma-style