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. 
ternary operator is used where ever possible as a replacement to the if condition to made the code look concise.