Fixed a few issues, cleaned up code a bit
Merge remote-tracking branch 'origin/master'