Added robustness to parsing
Added type checking while parsing