Simplified scalar product solution and fixed string format bug