I added some tests, now I will clean up the code