Refactor static file handling