Move check out of function to clean it up, maybe add checks to remove the spaces? Or checks