generalize flask with init