Refactored the skeleton generation into smaller methods.