Removed redundant code from JS