Added changes to python cell structure detection