Added basic error handling framework.