reorganize function to module