Add package search

I added package searching functionality as well as corrected the functionality of switches -i and -r