moving variable declaration
removing unnecessary parameter and assignments