Minor refactor for cleaner js