Syncing changes

Brought latest changes from Valloric's branch