Added docs for private methods and reordered the methods for better logical grouping.