Complete implementation, try to AC