Refined and bug free
Refined