Extracted K2-related code and removed dependencies.