Add two space indentation for JS
Refactor function out