refactor for cleanup and more fluid interface