added comments, possibly final version