split script into functions