Updated version, with angular js