Sample implementation, tidy code.