Refine examples

I have made some code in examples rubyish.