Moved payload decoding to a switch statement

Change-Id: I105b53c8717c99d21b357e347f5418d3aa7c8a02