Removed redundant code and fixed comments