Replace deprecated code

Tabs --> spaces (to make sure the code looks same everywhere). Changed
some variable names to something that describes them better. Replaced
some deprecated code.