refactored pqr stuff