Inspired by
Vectortuts+ tutorial
.