refactor prescriptions controller