Added check_spaces, untested code