Cleaned code from Leave() to bottom.