Working versions of most code