cleanup and adding tests