Removing premature optimizations
Fixed up broken test