Refactor image slider