rework wand library, some minor cleanup, and bug fix