made function name changes to action statements for readability. Also moved a couple variable declarations for clarity.