Using scala.util.Try rather than scala.Option for error handling.