Added error checking for empty keywords