Fixes warnings and enforces type safety