Complete a somewhat working implementation