adds variables and cleans up formatting