porting denigma to scala...