Removed warnings for implicit type conversions

I have made a few changes on variable types and return types for removing compilation warnings about implicit type conversions that can possibly lead to numerical errors.