Some improvements on ruby snippets