Improve Flash Algorithm Generation script