Added env-aware init. Added initial login functionality