Refactored the side pane animation code