Add docs for generics & fix formatting