removed unused vars

The code has also been reformatted for consistency.