Yes, this code is terrible, I know