More error handling
More error handling & clean up helper function, fix error in an edge case
Update documentation