Parametrize checking function

Got rid of four long and similar functions. Added parameter determining
the direction of connected thumb.