finished implementation. Ready for testing and debugging