cleaned up edge rendering code