Renamed "then" method to ensure since then is going to be a reserved word in Scala