removes unnecesary loop
removes space