moves part of functionality to a new method checkIfExists() for clarity