prettify borders and remove redundant code