Refactor code to a same style.
Remove dependency on ns module.
Write more tests.