Commented on more code, broke it into more functions, cleaned up a bit more.