mostly done, few bugs and documentation missing