Fixed Decode ways
Refactored to double loops