unspent optimization
bugfixes / reordering