clean analysis button logic