perfected existing code blocks