rtrim » chop
improve comments
control structures should use braces
replace logical operators with conditionals to improve readability