my god, this code is terrible