import old module files
refactor module, still work in progress
Merge pull request #1 from tosmi/master

merge refactoring upstream