better handling of mc stuff in php