Refactor checkin and checkout