refactor some functions in Helper.java