tried to follow coding style more strictly. deleted a lot of empty lines.