modified centering functionality and added corner orientation