Moved GetAttribute and optional equivalent into header and added more comments