migrating data storage functions into dedicated file