Move free functions into class.