add swap function to further neaten