Implemented a bunch of functions