Added a lot of new features (forget to commit meanwhile).