Starting refactoring, new ideas; new document function first test