why the usage of `getItem` here, when you check direct properties in the `if`?