add a vertical line and tidy up code