breaking out common js functionality. fixing border radius bug