added php flow control