closes #6, solves scoping problem