add test for fully wrapped and partially wrapped cases
try to un-spaghettify code a bit. still work to be done