convert methods to functions, massive speedup