Move `decode` stuff into own module, export it