Adding unit tests and some checkstyle fixes