Implemented and tested @JulienPalard's suggestion for issue #15