Move surface modeling functionality to separate file.