Re-coded JS