fixed padding and updated codes