move helpers to functions