migrate more functions to methods