Added 404-pages. Refactored 'frontend' and 'backend' detection.