added function for making sub dictionary