added logic and styling