added commentary, removed unused code