converted model to class. bug in cost remains.