Dinodex oop

Refactored the code based on inputs and comments from Sophia.
You can use the .nil? method usually when checking for nil but Hound states that in this case it is redundant.