Context manager

refactored harprofiler into a Context Manager class.