Some build fixes and auto removal of duplicate function definitions.