Better slug treatment and general improvements