using correct variable data types instead of using generic Object type

Using correct data type for the variables instead of using generic Object type and down casting it to appropriate type.