improve error handling, minor code cleanup, add repo