removed block properties and using local vars instead as per @mikedewar's suggestion