Added Comments. Added parsePattern to verify the pattern entered