Lots of styling changes and add a few tests