Fix and organize dependencies