edited to remove functions not relevant to most