Fix a few things, remove bad code