Added validate function and comments support