Working versions with tests