reorganized flask script and response templates