add comments. rename functions