changed all flow functions