working version with frame allocator