added tests, pre-publish script, re-organized code