Remove unused code
Fix identifiers, fixes #481
Remove unused definitions