Completed first Identity exchange NFC communication code (with lots of refactoring)