refine create_connection code style