add prev/next buttons plus prev algoritm with bug