putMainRes added (and hopefully finished)