cleanup; optimization stuff