Fix many bugs and improve code