clearL is old function to clear all local variables. If your slam functions use local variables, the former should work. But if they use other variables, the former won't work.
TLDR, we need to see your slam functions. Copy and paste them in your reply.