Added common unit tests for all implementations, lots of cleanup