minor rubyish fixes to variables, signatures and precedence