working code locally ,assuming certain setup