Added some test functionality and fixed some errors with certain inputs