Added more logic to parser.