[Refactoring] Creating some functions