beginnig of analysis code