replaced bad code from stackoverflow

NOW: fixed error throwing code from stackoverflow with my own
implementation (throws no errors)
NEXT: Edit in place
THEN: Ship it
EVENTUALLY: add managers and preset groups