Removing unnecessary variables to eliminate compiler warnings