Set up environment and login