Code from a go course I followed. The original code from the course can be found here