simplified cover searching code a little bit;