Change per with by and fix minor issues