updated to include border size in width/height calculations, made work in no-conflict mode