code cleanup to models