Parser improved. Added exception handling