Cleaned up some function names, commented many functions