Reduce redundant code in platform assignment

Sorry I didn't think of this earlier.