Removed the static global state from Gunsmith
Added optionals for better null handling