Adding basic security logic