Improve method to add functions