Finished adding tests and updated implementation