use java 8 optional instead of null control