cleaned up matching scheme code