Minor restructure, will move to libs later anyway
More tidiness
Better function name