Added replace spaces algorithm