e.c algorithm mostly documented