Updated analog code