updated comments and cleaned up dead code