Clean up some type identifiers and use let more than var