Fixed or removed issues that impact code styles. Also removed dead code