Template from @guadan2001 integrated.