Added stages logic