Added support form md5. Also imported some minor changes from Agora