Fixed an error and added more testing