Started implementation of bars detection. Not working yet.