First commit mainly based on the agent charm