Split each function into three