added drawing variables algorithm