added preconditions() function