Implement set_level