Added recent search tags and refactored other parts of the code