Fix processing and start adding tests