Simplified the code with list comprehensions.
Added notes in documentation about .