Refactored stuff — more functions, less arguments