code clean-up: got rid of several warnings like deprecations, possible NPE and so on