Code cleanup.

Removed redundant declarations and checks in the code.