move shapes recognition stuff to separate class