More fixes
Simplified code removing useless aux functions