More testcases

Fixed some small code styles and write more unittests