Tidied up bits implementation