added precondition checks
added precondition checks