moved general functions to helpers