added few conditions