first couple functions' logic going ok