Implement the Decode func
Fix failing test for Decode