Fixed ref bit stuff and clearing pages. Debug is also added
Merge branch 'tonyEdits'