main: rename connection, streamline init_layout and error handling