added comments. cleaned out old code