addressed comments
less unused vars, and superfluous opens