A microscopic model for phase transitions in traffic flow