Fixed typo and simplified sizes algorithm