minor victory, but code a mess