implement input decode (not working yet)