Changed to use js objects