Removed redundancy and various other modifications