a little refactoring after watching videos