Incorporated all suggested changes, with the exception of line length warnings