Modified: restructured var declerations for readability