Replace deprecated functions
Remove redundant local variables
Remove some redundant closing tags
Merge pull request #45 from jamiesnape/DeprecatedUnused

Replace deprecated functions, remove redundant local variables and closing tags