updated to Greg's changes