hideous. need to rewrite both