Refactor java script ace 107