initial commit, tested, with comments and scaladocs