Added code documentation and created a function for clearing the details fields