Refactor and add support for setting slider position by clicking