class and variable fixes, remove unused code