Added Tests, and moved some methods to an abstract class