fix arg types and cleanup