Various fixes, added PIN format and constant time comparison.