Added two methods to the web interface (and implemented them).
Also some refactoring.