Few changes, fixes, and error handling