chagned retreiving logic