Fix divide by zero error in position, restructure