shifting about code to generalise the scripts a bit more