code cleanup, solved problem 21, 22, 23, 25