Adding mapping and a debug function