Removed hack from last commit and replaced it with a more elegant, permanent fix