Changed api as suggested by dnarvaez