diff --git a/.gitignore b/.gitignore
index fe3f3a4..9883354 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,12 @@
+.idea
 CMakeCache.txt
 CMakeFiles/
 CPackConfig.cmake
 CPackSourceConfig.cmake
 Makefile
 cmake_install.cmake
+install_manifest.txt
 pgagent
-pgagent--3.4.sql
 pgagent.control
 *.log
+*.sql
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5968b25..1be24da 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,7 @@
 #######################################################################
 #
 # pgAgent - PostgreSQL tools
-# Copyright (C) 2002 - 2016, The pgAdmin Development Team
+# Copyright (C) 2002 - 2018, The pgAdmin Development Team
 # This software is released under the PostgreSQL Licence
 #
 # CMakeLists.txt - CMake build configuration
@@ -62,12 +62,12 @@ PROJECT(pgagent)
 # in pgagent.sql and upgrade_pgagent.sql if the major version number is
 # changed. The full version number also needs to be included in pgAgent.rc and
 # pgaevent/pgamsgevent.rc at present.
-SET(VERSION "3.4.1")
+SET(VERSION "4.0.0")
 
 # CPack stuff
-SET(CPACK_PACKAGE_VERSION_MAJOR 3)
-SET(CPACK_PACKAGE_VERSION_MINOR 4)
-SET(CPACK_PACKAGE_VERSION_PATCH 1)
+SET(CPACK_PACKAGE_VERSION_MAJOR 4)
+SET(CPACK_PACKAGE_VERSION_MINOR 0)
+SET(CPACK_PACKAGE_VERSION_PATCH 0)
 SET(CPACK_PACKAGE_NAME "pgAgent")
 SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "pgAgent is a job scheduling engine for PostgreSQL")
 SET(CPACK_PACKAGE_VENDOR "the pgAdmin Development Team")
@@ -142,11 +142,9 @@ TARGET_LINK_LIBRARIES(
 IF (WIN32)
     INSTALL(TARGETS pgagent DESTINATION .)
     INSTALL(FILES ${pgagent_SOURCE_DIR}/sql/pgagent.sql DESTINATION .)
-    INSTALL(FILES ${pgagent_SOURCE_DIR}/sql/pgagent_upgrade.sql DESTINATION .)
 ELSE(WIN32)
     INSTALL(TARGETS pgagent DESTINATION bin)
     INSTALL(FILES ${pgagent_SOURCE_DIR}/sql/pgagent.sql DESTINATION share)
-    INSTALL(FILES ${pgagent_SOURCE_DIR}/sql/pgagent_upgrade.sql DESTINATION share)
 ENDIF(WIN32)
 
 INSTALL(FILES ${pgagent_SOURCE_DIR}/README DESTINATION .)
diff --git a/LICENSE b/LICENSE
index 37d66d1..02fdb93 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
 pgAgent
 
-Copyright (c) 2002 - 2016, The pgAdmin Development Team
+Copyright (C) 2002 - 2018, The pgAdmin Development Team
 
 Permission to use, copy, modify, and distribute this software and its
 documentation for any purpose, without fee, and without a written agreement is
diff --git a/cmake/MakeExt.cmake b/cmake/MakeExt.cmake
index cbfb20e..7a2499f 100644
--- a/cmake/MakeExt.cmake
+++ b/cmake/MakeExt.cmake
@@ -1,7 +1,7 @@
 #######################################################################
 #
 # pgAgent - PostgreSQL tools
-# Copyright (C) 2002 - 2016, The pgAdmin Development Team
+# Copyright (C) 2002 - 2018, The pgAdmin Development Team
 # This software is released under the PostgreSQL Licence
 #
 # MakeExt,cmake - Create the PG Extension
diff --git a/connection.cpp b/connection.cpp
index 492281f..15f6067 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // connection.cpp - database connection
diff --git a/include/connection.h b/include/connection.h
index 0779297..ae48f71 100644
--- a/include/connection.h
+++ b/include/connection.h
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // connection.h - database connection
diff --git a/include/job.h b/include/job.h
index eae32b3..7183069 100644
--- a/include/job.h
+++ b/include/job.h
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // job.h - agent job
diff --git a/include/misc.h b/include/misc.h
index 83e5c80..e030c60 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // misc.h - misc functions
diff --git a/include/pgAgent.h b/include/pgAgent.h
index 2aaa11d..dc8dd7e 100644
--- a/include/pgAgent.h
+++ b/include/pgAgent.h
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgAgent.h - main include
diff --git a/job.cpp b/job.cpp
index 56d7b9c..29c5611 100644
--- a/job.cpp
+++ b/job.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // job.cpp - pgAgent job
diff --git a/misc.cpp b/misc.cpp
index b644aab..a245fa4 100644
--- a/misc.cpp
+++ b/misc.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // misc.cpp - misc functions
diff --git a/pgAgent.cpp b/pgAgent.cpp
index 489a2d1..6928e4d 100644
--- a/pgAgent.cpp
+++ b/pgAgent.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgAgent.cpp - pgAgent main entry
diff --git a/pgAgent.rc b/pgAgent.rc
index d4a81a8..ddb5978 100644
--- a/pgAgent.rc
+++ b/pgAgent.rc
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 // 
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgAgent.rc - win32 Resources
@@ -16,8 +16,8 @@ aaaPGAGENT      ICON    DISCARDABLE     "include/pgAgent.ico"
 
 
 VS_VERSION_INFO VERSIONINFO
-FILEVERSION    3,4,1,0
-PRODUCTVERSION 3,4,1,0
+FILEVERSION    4,0,0,0
+PRODUCTVERSION 4,0,0,0
 FILEOS         VOS__WINDOWS32
 FILETYPE       VFT_APP
 BEGIN
@@ -25,15 +25,15 @@ BEGIN
     BEGIN
         BLOCK "040904E4"
         BEGIN
-            VALUE "FileVersion",     "3.4.1", "\0"
-            VALUE "File Version",    "3.4.1", "\0"
+            VALUE "FileVersion",     "4.0.0", "\0"
+            VALUE "File Version",    "4.0.0", "\0"
             VALUE "FileDescription", "pgAgent - PostgreSQL Scheduling Agent", "\0"
-            VALUE "LegalCopyright",  "\251 2002 - 2016, The pgAdmin Development Team", "\0"
+            VALUE "LegalCopyright",  "\251 2002 - 2018, The pgAdmin Development Team", "\0"
             VALUE "LegalTrademarks", "This software is released under the PostgreSQL Licence.", "\0"
             VALUE "InternalName",    "pgAgent", "\0"
             VALUE "OriginalFilename","pgagent.exe", "\0"
             VALUE "ProductName",     "pgAgent", "\0"
-            VALUE "ProductVersion",  "3.4.1", "\0"
+            VALUE "ProductVersion",  "4.0.0", "\0"
         END
     END
     BLOCK "VarFileInfo"
diff --git a/pgaevent/CMakeLists.txt b/pgaevent/CMakeLists.txt
index 4dda032..532c984 100644
--- a/pgaevent/CMakeLists.txt
+++ b/pgaevent/CMakeLists.txt
@@ -1,7 +1,7 @@
 #######################################################################
 #
 # pgAgent - PostgreSQL tools
-# Copyright (C) 2002 - 2016, The pgAdmin Development Team
+# Copyright (C) 2002 - 2018, The pgAdmin Development Team
 # This software is released under the PostgreSQL Licence
 #
 # pgaevent/CMakeLists.txt - CMake build configuration
diff --git a/pgaevent/pgaevent.c b/pgaevent/pgaevent.c
index d252f05..5552168 100644
--- a/pgaevent/pgaevent.c
+++ b/pgaevent/pgaevent.c
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 // 
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgaevent.c - win32 message format dll
diff --git a/pgaevent/pgaevent.def b/pgaevent/pgaevent.def
index 8f155c0..3e89d27 100644
--- a/pgaevent/pgaevent.def
+++ b/pgaevent/pgaevent.def
@@ -2,7 +2,7 @@
 ; //
 ; // pgAgent - PostgreSQL Tools
 ; // 
-; // Copyright (C) 2002 - 2016 The pgAdmin Development Team
+; // Copyright (C) 2002 - 2018 The pgAdmin Development Team
 ; // This software is released under the PostgreSQL Licence
 ; //
 ; // pgaeventdef - pgaevent.dll exports
diff --git a/pgaevent/pgamsgevent.h b/pgaevent/pgamsgevent.h
index 9129aa0..720a0d3 100644
--- a/pgaevent/pgamsgevent.h
+++ b/pgaevent/pgamsgevent.h
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgamsgevent.h - Message id declarations
diff --git a/pgaevent/pgamsgevent.rc b/pgaevent/pgamsgevent.rc
index 1897727..aca0b0f 100644
--- a/pgaevent/pgamsgevent.rc
+++ b/pgaevent/pgamsgevent.rc
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 // 
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgaevent.rc - win32 Resources
diff --git a/precomp.cpp b/precomp.cpp
index 8860aee..82e6e0c 100644
--- a/precomp.cpp
+++ b/precomp.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // precomp.cpp - pgAgent precompiled headers
diff --git a/sql/pgagent--3.4--4.0.sql b/sql/pgagent--3.4--4.0.sql
new file mode 100644
index 0000000..7238210
--- /dev/null
+++ b/sql/pgagent--3.4--4.0.sql
@@ -0,0 +1,19 @@
+/*
+// pgAgent - PostgreSQL Tools
+// 
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
+// This software is released under the PostgreSQL Licence
+//
+// pgagent--3.4--4.0.sql - Upgrade the pgAgent schema to 4.0
+//
+*/
+
+\echo Use "CREATE EXTENSION pgagent UPDATE" to load this file. \quit
+
+CREATE OR REPLACE FUNCTION pgagent.pgagent_schema_version() RETURNS int2 AS '
+BEGIN
+    -- RETURNS PGAGENT MAJOR VERSION
+    -- WE WILL CHANGE THE MAJOR VERSION, ONLY IF THERE IS A SCHEMA CHANGE
+    RETURN 4;
+END;
+' LANGUAGE 'plpgsql' VOLATILE;
\ No newline at end of file
diff --git a/sql/pgagent--unpackaged--3.4.sql b/sql/pgagent--unpackaged--3.4.sql
index 27818a8..81794fa 100644
--- a/sql/pgagent--unpackaged--3.4.sql
+++ b/sql/pgagent--unpackaged--3.4.sql
@@ -1,7 +1,7 @@
 /*
 // pgAgent - PostgreSQL Tools
 // 
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgagent--unpackaged--3.4.sql - Convert pgAgent existing tables and functions to an extension
diff --git a/sql/pgagent.sql b/sql/pgagent.sql
index ae61b5b..7eb42ba 100644
--- a/sql/pgagent.sql
+++ b/sql/pgagent.sql
@@ -1,7 +1,7 @@
 /*
 // pgAgent - PostgreSQL Tools
 // 
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // pgagent.sql - pgAgent tables and functions
@@ -39,7 +39,7 @@ INSERT INTO pgagent.pga_jobclass (jclname) VALUES ('Data Export');
 INSERT INTO pgagent.pga_jobclass (jclname) VALUES ('Data Summarisation');
 INSERT INTO pgagent.pga_jobclass (jclname) VALUES ('Miscellaneous');
 -- Be sure to update pg_extension_config_dump() below and in
--- pgagent--unpackaged--3.4.sql when adding new classes.
+-- upgrade scripts etc, when adding new classes.
 
 
 CREATE TABLE pgagent.pga_job (
@@ -149,7 +149,7 @@ CREATE OR REPLACE FUNCTION pgagent.pgagent_schema_version() RETURNS int2 AS '
 BEGIN
     -- RETURNS PGAGENT MAJOR VERSION
     -- WE WILL CHANGE THE MAJOR VERSION, ONLY IF THERE IS A SCHEMA CHANGE
-    RETURN 3;
+    RETURN 4;
 END;
 ' LANGUAGE 'plpgsql' VOLATILE;
 
diff --git a/sql/pgagent_upgrade.sql b/sql/pgagent_upgrade.sql
deleted file mode 100644
index c8b1893..0000000
--- a/sql/pgagent_upgrade.sql
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-// pgAgent - PostgreSQL Tools
-// 
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
-// This software is released under the PostgreSQL Licence
-//
-// pgagent_upgrade.sql - Upgrade pgAgent tables and functions
-//
-*/
-
-CREATE OR REPLACE FUNCTION pgagent.pgagent_schema_version() RETURNS int2 AS '
-BEGIN
-    -- RETURNS PGAGENT MAJOR VERSION
-    -- WE WILL CHANGE THE MAJOR VERSION, ONLY IF THERE IS A SCHEMA CHANGE
-    RETURN 3;
-END;
-' LANGUAGE 'plpgsql' VOLATILE;
-
-CREATE OR REPLACE FUNCTION pgagent.pga_exception_trigger() RETURNS "trigger" AS '
-DECLARE
-
-    v_jobid int4 := 0;
-
-BEGIN
-
-     IF TG_OP = ''DELETE'' THEN
-
-        SELECT INTO v_jobid jscjobid FROM pgagent.pga_schedule WHERE jscid = OLD.jexscid;
-
-        -- update pga_job from remaining schedules
-        -- the actual calculation of jobnextrun will be performed in the trigger
-        UPDATE pgagent.pga_job
-           SET jobnextrun = NULL
-         WHERE jobenabled AND jobid = v_jobid;
-        RETURN OLD;
-    ELSE
-
-        SELECT INTO v_jobid jscjobid FROM pgagent.pga_schedule WHERE jscid = NEW.jexscid;
-
-        UPDATE pgagent.pga_job
-           SET jobnextrun = NULL
-         WHERE jobenabled AND jobid = v_jobid;
-        RETURN NEW;
-    END IF;
-END;
-' LANGUAGE 'plpgsql' VOLATILE;
-COMMENT ON FUNCTION pgagent.pga_exception_trigger() IS 'Update the job''s next run time whenever an exception changes';
-
-ALTER TABLE pgagent.pga_jobstep ADD COLUMN jstconnstr text NOT NULL DEFAULT '' CONSTRAINT pga_jobstep_connstr_check CHECK ((jstconnstr != '' AND jstkind = 's' ) OR (jstconnstr = '' AND (jstkind = 'b' OR jstdbname != '')));
-ALTER TABLE pgagent.pga_jobstep DROP CONSTRAINT pga_jobstep_check;
-
-ALTER TABLE pgagent.pga_jobstep ADD CONSTRAINT pga_jobstep_dbname_check CHECK ((jstdbname != '' AND jstkind = 's' ) OR (jstdbname = '' AND (jstkind = 'b' OR jstconnstr != '')));
diff --git a/unix.cpp b/unix.cpp
index 7098e9b..f6843f9 100644
--- a/unix.cpp
+++ b/unix.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016, The pgAdmin Development Team
+// Copyright (C) 2002 - 2018, The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // unix.cpp - pgAgent unix specific functions
diff --git a/win32.cpp b/win32.cpp
index 1114dd0..07ddb60 100644
--- a/win32.cpp
+++ b/win32.cpp
@@ -2,7 +2,7 @@
 //
 // pgAgent - PostgreSQL Tools
 //
-// Copyright (C) 2002 - 2016 The pgAdmin Development Team
+// Copyright (C) 2002 - 2018 The pgAdmin Development Team
 // This software is released under the PostgreSQL Licence
 //
 // win32.cpp - pgAgent win32 specific functions
