Start adding logic to refactor JS.