Fixed to compile
Updated code with latest from main branch