added support to cycle backwards, thanks nicdal for suggestion