cleanup calloc calls to not cast, fixed parameter order because im smart