Changed interfaces and added tests