Adding type annotations and fixing up formatting.