implemented encoding as a lists:map as well as a list comprehension