First working revision of analysis functions