code cleanup and trying to fix internal and sd card's