Improved addon code