Adapter interfaces

Use adapter interfaces instead of reflection for comparison and math functions