Does all functions

Does all the functions, but needs to be cleaned up aesthetically.