add hardlink extraction support, more refactoring
better error handling
minor fixes