Updating and cleaning up code for testing