reformated the code and put in some validation logic