Generalised projection

Complete revision:

See previous pull requests