Move cost functions to models module