Added very basic error handling