adopting code to fit all editions