Refactoring recording functions