Altered code so it doesn't use bitset lib