Condensed the code