Remove unnecessary variables and organize imports