added null check for delegated methods to prevent null pointer exceptions
fixed spacing and imports