Updated to newer APIs
Code cleanup