dividend refactored, ufff a lot of work