Added some more functionality and some tests