code cleanup. everything works for now