Removed the read loop and made pin values on demand to improve performance