abstract code to fucntions