Additional fixes #20 duplicate code