preconditions added to both functions