Refactors file structure. Fixes simulation problems using typeclasses. Adds sbt build file.