update mm, reorg api.php; breaking out different api calls