Changed eqnarray to align. Changed figures to algorithms.
pseudo-code: changed from figure to algorithm.