Fixed comment display bug

.... Cleaned up code (added more comments, grouped/labeled functions for clarity).