Changed more code to cross-compatibility