Add basics.rb and rewrite some code