replace method to func