Code clean up. Context.generate_references () method added