Some code erros, better types
Some code erros, better types