Cleanup and fix startup intent handling