Code cleanup (ammended)