Refactor functions places