Thanks for the comments guys. And wow, $modespl is awesome, didn't know about that. :) I assume that sets itself to the max allowed on the server?
I've made some minor adjustments, shouldn't take long to make it be able to do multiple modes.