Cleaned up routing and serving logic.