Removed redundant code, updated comments