code from version 0.3 of the addon