Added exception handling for input larger than 4 bits.