Arrrgh this is terrible code!