Added some testing and cleanup