More cleanup; cookie fixes, Flask integration.