rewrote algorithm after getting some help
changed package to operators