added code plus reflection