Fixes and Improvements

Clears all warnings and enforces type safety.