Added loading data - refactor it to function