tweaked js to make page work cleaner