minor changes and cleanup in main