Modified by Apichart Rungphati.