major bug fixes... was a bit out of it last commit.