final fixed script. yet to design tests for it
final fixed script. yet to design tests for it