Fixed many unused vars, includes, fixed non closed file streams, fixed
static value access