Context manager

refactored harprofiler into a Context Manager class.
fixed that also.