base error handling added. needs more work.