public ArrayList<SubscriptionPlan> removeExpiredSubs() {
        ArrayList<SubscriptionPlan> result = new ArrayList<SubscriptionPlan>();
        ArrayList<Integer> subremove = new ArrayList<Integer>();
        ArrayList<Integer> orderremove = new ArrayList<Integer>();
        PreparedStatement sqlRead = null;
        ResultSet res = null;
        openConnection();
        try {
            sqlRead = connection.prepareStatement("SELECT subscriptionplan.*, orders.orderid "
                    + "FROM orders, SUBSCRIPTIONPLAN WHERE orders.subscriptionid = "
                    + "subscriptionplan.subscriptionid AND subscriptionplan.enddate <= CURRENT DATE");
            res = sqlRead.executeQuery();
            while (res.next()) {
                int orderid = res.getInt("orderid");
                orderremove.add(orderid);
                int subid = res.getInt("subscriptionid");
                Date startdate = res.getDate("startdate");
                Date enddate = res.getDate("enddate");
                Time time = res.getTime("timeofdelivery");
                int day = res.getInt("weekday");
                String username = res.getString("companyusername");
                java.util.Date utilstart = startdate;
                java.util.Date utilend = enddate;
                SubscriptionPlan plan = new SubscriptionPlan(subid, utilstart, utilend, time, day, username);
                if (!subremove.contains(subid)) {
                    subremove.add(subid);
                }
                result.add(plan);
            }
            for (int i = 0; i < orderremove.size(); i++) {
                PreparedStatement sqlRemove1 = connection.prepareStatement("DELETE FROM dishes_ordered WHERE orderid = ?");
                sqlRemove1.setInt(1, orderremove.get(i));
                sqlRemove1.executeUpdate();

            }
            for (int i = 0; i < orderremove.size(); i++) {
                PreparedStatement sqlRemove2 = connection.prepareStatement("DELETE FROM orders WHERE orderid = ?");
                sqlRemove2.setInt(1, orderremove.get(i));
                sqlRemove2.executeUpdate();
            }
            System.out.println("Subremovelength: " + subremove.size());
            System.out.println("Orderremovelength: " + orderremove.size());
            for (int i = 0; i < subremove.size(); i++) {
                PreparedStatement sqlRemove3 = connection.prepareStatement("DELETE FROM subscriptionplan WHERE subscriptionid = ?");
                sqlRemove3.setInt(1, subremove.get(i));
                sqlRemove3.executeUpdate();
            }
        } catch (SQLException e) {
            System.out.println(e.getMessage());
        } finally {
            Cleaner.closeConnection(connection);
            Cleaner.closeResSet(res);
            Cleaner.closeSentence(sqlRead);
        }
        return result;
    }