refactor js, cleanup controller proc