cleaner http handling in main