refactor csma