Remove ref added. Updated logic in some places to suit reqs.