Part of my course work and hope to put some optimization into it