* Use not deprecated APIs where possible * Added some NPE safety checks * General cleaning of unsed code