Move helper functions to helpers.inc