fixed padding/key, added msg var for clarity