Added some var prefixes to avoid possible scoping clashes in Ruby