@Override
    public Command nextCommand() {

        if (thereIsAnUnreachedGoal()) {
            if (cabin.areDoorsOpened()) {
                return close();
            }
            if (isNextGoalAbove()) {
                return up();
            } else {
                return down();
            }
        }

        if (goalReached()) {
            removeGoal();
            return open();
        }

        return Command.NOTHING;
    }