Added an option to set the before/after orientation (either horizontal or vertical)