Move checks to function body to make calling them easier and safer