added local declarations and assignments of variables and while loop...need to make variables mutable and function calls evaluate to expressions for while loop to really be effective