Made the the logic in adjacency calculations more versatile for future additions