Separated functions to new file

Running into issues with including header files in different folders.
For now I've put files into root, but should try to find solution.