more readble code to retrive records from database