simplified initial setup function
reducing the number of times we are accessing the dom