Clean up code; clear some minor TODOs