Some minor cleanup; improved speed