formats code
fixes type errors