good god... this needs a cleanup