changed function declarations to vars