Refactored to use css transition