remoed unnecessary logs and moved code from one method to another
remoed unnecessary logs and moved code from one method to another