Updated Qlearner and cleaned code