Cleaned up code and fixed code throwing exceptions
Merge remote-tracking branch 'origin/master'