Removed redundant and inefficient code.