reorganized code for sbt building