Restructured for fewer lines of code