Added method for submitting pin code. Added comments. Refactored code.