Optimal financial contracting and the effects of firm's size