added new logic and fixed some css