Clean up and delete some unused code