Remove code that is not used and added tests