Update element.rb

Fixed various issues with scope, the Ruby way of things, etc.