added some new features and general fixes.