sloppy, but it works