Some general cleanup

Useless variables removed, typos and variable names corrected