Added comments and validation loop