add logging option as argument
remove state counting
logging usage