Refactor into separate handlers