moving functions to appropriate file