implemented usage logic with JavaScript