typecast fixes, proper parameters, and formatting changes