various modifications

see diff

still not any real implementation, just skeleton