added csma layer and removed some dead code