Dynamics of molecular evolution