Updated some formatting, found a scoping error with a flow control varialbe