updated js to be a bit cleaner