Moved error messages to functions' return value.