Add switch statement and fix for padding.