improvements, more flexible interface