Cleaned up model code and tests

Model code cleanup
@alice-wang