got some changes from ofLight rewrite in there