Added the option to specify a gap from the border