reworking the code and adding tests