refactored Edge inner class