Fix PHP Fatal from unchecked getStorage()

Additionally made a few changes for a slightly optimized approach.