converted unit search function to use an array instead of an additional parsing loop