...... removed debug prints
added some utilities