refactor code to remove global variables and optimize
filter and search params are stored in session
add products passed in the product list