Added edge detection and changed menu system.