first verbose implementation, then tidy