blargh...working, but feels extremely hacky...