implementation complete, needs debugging.