Couldn't get lines to work using seperate functions, so here they are tidied up a bit for a fresh start tomorrow.