fixed a bug concerning backwards playing
prettified, commented and reorganized some code