Move back the clear/restore functions into the proper namespace.
Cleanup commented code and fix indentation.
Cleanup: remove debug statement.