More unit tests and removing some unused code.