refactoring fingerprint code