implemented working version
removed non required logs, fixed select