removed unused variables and extra logging