Split up functions refactoring