added analyze function.