Fixed logic for set functions so that they do not fail every single time.
Fixed setting of wrong internal variables.
Merge pull request #1 from SamJBarney/master

Fixed glaring errors.
derp derp, thanks! --mgribov