still trying to figure out why output isn't correct