Full template script fix by j0linar