Removed hasX() methods

Removed hasX() boolean functions and changed getX() to
return Optional<X>.