Added basic error framework