from chaos to madness
cleaned the code some more