refactor module, still work in progress