this code is actually awful