Code cleanup, added Error class.