added sorting
updated searching with linear