Cleanup and re-annotate code