revamped logic for flex psotioins