changed to mozilla-style indentation, removed some trailing whitespace