counter implemented, need to pass it and to modify main
counter implemented, need to pass it and to modify main
materialization fully working