Api v3 upgrade and some cleaning up