functions max-kof etc improved