started implementing serial algorithm