Adding the code + tests