Created Error class; lots of changes