took out group logic from user function, more PDO implementation.