Removed redundant and bug-prone javascript