Minor API changes and adding tests