error handling (not yet complete)
merge with error handling