Unbreaking my attempt at unbreaking JS