re-factored with angular