Refactored and documented scala lib
Added rake test task