Big Commit

Added some of my own code and did a merge for alex as well.