refactored chal02.py