Cleanup and port from Bitbucket.