Added comments, moved setup code to a less confusing location.