Added functionality to next/prev buttons. More bug testing may be needed though.