Replaced costs common methods coffeescript with plain javascript