Implemented the code that fixes #8