[refac] moved helper functionality outside the .c file so it's availible across the project