Clean up and remove unused code