fix Decode
extraxt consts
move publics to top
simplify Decode