Reduce redundant code in platform assignment