Added more JS stuff with the logic