Added Rakefile and fixed tests