added ability to specify margins