Added comments.
Added type hinting.