Just ported over some stuff