code has been cleaned up and commented, loading bar is dynamic based off of width