Fixing various bugs and improving user error checking for input