move to a controller or core/ajax