move body compilation to separate method