fixed most of analysis phase