Improve module, add tests