Handle cyclical dependencies

This patch handles cyclical dependencies by keeping track of what requires have already been seen (`seen` array) and makes sure that they are not checked again.

This fixes #8.