Oops. Found a few bugs. This commit fixes them. On the lookout for more