Great.
Also it would be nice if you could fix minor incorrect behavior with COMMIT called after PREPARE TRNSACTION, though this is not error, but this produces a WARNING in PostgreSQL log, which 1) pollutes log file, making it hard to read, 2) slow down performance, because for every transaction warning line have to be written.
Explanation: when PREPARE TRANSACTION statement is executed the current transaction is promoted to Prepared and it's no longer associated with current session (connection), it is no longer considered a current transaction, so calling COMMIT will produce a warning telling that there is no current transaction in progress, only COMMIT PREPARED statement is needed.
Quote from
PostgreSQL documentation:
Issuing COMMIT when not inside a transaction does no harm, but it will provoke a warning message.