added multisample support, thanks Colt McAnlis