Added some new functions, cleaned up some tests