Fix issue with else blocks, add range functionality