Cleaned up unnecassary discovery of refs, added config file etc