first full working version - in emulation, at least!