minor modifications, now supports comments, serializes the input for better use and builds the dictionary