Fixed code redundancy in #4 patch