removed debug outputs and fixed indentation