improve error handling
add documentation and make debugging easier