add more tests and modify modules to be easier to test