void* is promoted to any other pointer type automagically, so removed casts from malloc calls and changed typename to variable name for ease of maintenance.