Cleanup and remove unused code