refactored main.scala into multiple files