separated code into different files
cleanup of code of sim.att