Cleaned up superfluous code
Fixed up tests