cleaned up code, removed unnecessary variable