apparently those while loops were useless