refactored to give external control over id's