refactored good-code/bad-code snippet to be more readable