copied from microc