Made some name changes and made code more readable