Extend documentation, fix bug