Add unit test, some slight reformating