closes #151; implemented if-block