Refactoring. Tests for handlers.