refactored, moved functionality to router