Scala implementation of Trapper