Added more precondition checks