overflowing code, needs simplification