add the missing import
move decoding to class
nice up the test