Added the cost to tile function.