Status change code moved up

Created bookStatus variable and moved the status change code up.