Added error handling to enum