Minimized Code from 32 lines to 22 lines.