Type Safety

Enforce type safety and address all warnings.