Fixed Scoping Errors