a lot of this is pretty hacky, but I think it's starting to look good functionality-wise