if main and add a few missing bits