refactor methods for highlevel JS API