Fix some code/Remove unused code