Added disconnect handling, fixed method selection