make max dynamic