Improve code styles, write more tests