Redistributed misc.php

Also made it OO programming style