Finalized implementation, ready for testing