filled in the rest of the functionality alongside tests