fixed a scope issue and made things more readable