improved platform.h