moved some functions into own directory - neater