not working, commit anyway. TODO: flatten vertices representation