Added basic javadoc and added a null check
Improved example usage