Adding condition checking