some commenting and type fixing