Refactor to modules and test directory.