moved all functions into the same file and organized them