refactor the SLM class