updated replacing bitmaps, adding tracing