Added unit tests for several functions. (Still incomplete.)