moved to coffeescript common functions