Added existing code, reformatted code, ran code inspector for some corrections