working on reference generation