refactor records method