removed some of the duplication
removed duplication, added a toggle and added support for <>