Fixed some problems with style and added more unit tests