improve some ruby snippets