move handler function to parent and css adjustment