fix bugs, improve code, improve webpage, add some small features

I took my time and look at the code and have found and fixed some bugs
as well as improve some code and webpage so please take a look.