now with comments and cleaner indentation