Null check added and Principal and Serializable added as implemented interfaces.
Fixed typo (principle -> principal)