reworked

Changed the JS slightly