error handling
merging
code cleanup