fixed sliding behavior. removed some duplication.