removed duplicate code closes #51