Refactored Chapter3 examples