Resolved race condition when starting adapter after logging in.

Mainly this is about fixing the race condition and replacing complex logic with a promise.

But it also removed the duplicate ziniki files, fixed some space/tab issues and cleaned up other things.