Add notation and tidy code