lesson14:refactor a bit