- code cleanup and type fixes