refined js logic and made styling pretty :)