start of analysis code