first and third stage implemented