add debug controls and reference ide
refactor reference ide
Merge branch 'debug' into dev