flow control and functions done