Cleaning up a bunch of functions... Adding some documentation.