Remove shadow code repetition