re-written for generic use in all projects