Working Code(verified)

Add printf when where ever required. Good data