Made some changes per Dmitriy