cleanup the decode lib and modified the parse function to reflect the changes