Rewrote while in Go, added map function