Made the functions look more standardized by including the same error handling message in most of them