Added very rough error handling